package interview.huawei.tjt.training.huaweijishitiku;

import java.util.Scanner;

// 输出单向链表中倒数第k个结点
public class HJ51 {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        while ( sc.hasNextInt() ) {

            int n = sc.nextInt();
            int[] l = new int[n];

            for ( int i = 0; i < n; i ++ ) {
                l[i] = sc.nextInt();
            }

            int m = sc.nextInt();
            if ( m <= l.length && m > 0 ) {
                System.out.println(l[l.length - m]);
            } else if ( m == 0 ) {
                System.out.println(0);
            }

        }

    }

}
